<?php
/***************************************************************************/
/* SPD Nast�tten                                                           */
/* ===========                                                             */
/*                                                                         */
/* Copyright (c) 2006-2008 by Lukas Schreiner, Pascal Villmann             */
/* For more information visit: http://spd-nastaetten.de                    */
/*                                                                         */
/*                                                                         */
/* This program is free software. You can redistribute it and/or modify    */
/* it under the terms of the GNU General Public License as published by    */
/* the Free Software Foundation; either version 0.2 of the License.        */
/***************************************************************************/
//Konfigurations-Sicherheits-Key
$config_secure_key_client = "S?a58tM!}J3gb&Z6E9{pk*Q2H1=o_Pr4Td0-7W/qCx7n2+AYf5%8?iB%zL0";
//Konfigurationsdateien einf�gen
require_once('./system/settings.inc.php');
//Markierung und Unterlinks
$home_section = "kontakt.php";
$section = "kontakt.php";
//IP Adresse ermitteln und zu $ip zuordnen
$ip=$_SERVER["REMOTE_ADDR"];
$host=gethostbyaddr($ip);
//E-Mail auslesen
if(isset($_GET['trme'])){
$recipient = $_GET['trme'];
}else{
$recipient = '';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php
include('./layout/head_meta.inc.php');
?>
  <style>
<!--
                .text { font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px;}
                .bild-text {color:#C0C0FF; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 10px;}
-->
  </style>
</head>
<body scroll="auto" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" bgcolor="#A70D01">
  <div align="center">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td rowspan="3"><a href="kontakt.php">
      <img name="top" src="images/spdde/portal/top/t1_1_1.gif" alt="" border="0" width="141" height="70" /></a></td>
      <td><img src="images/spdde/portal/top/t1_2_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_3.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_4_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_5.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_6_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_7.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_8_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_9.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_10_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_11.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_12_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3">
      <img border="0" src="images/spdde/portal/top/logo_neue_staerke.jpg" width="206" height="70"></td>
      <td><img src="images/spdde/portal/top/t1_14_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_15.jpg" alt="" width="10" height="70" /></td>
    </tr>
    <tr>
      <td><a target="_blank" href="http://www.spd.de/">
      <img border="0" src="images/spdde/portal/top/ch_quadrat_portal_aktiv.gif" width="49" height="49"></a></td>
      <td>
      <a target="_blank" href="http://www.spd.de/servlet/PB/menu/1009322/index.php">
      <img border="0" src="images/spdde/portal/top/ch_quadrat_presse_over.gif" width="49" height="49"></a></td>
      <td>
      <a target="_blank" href="http://www.spd.de/servlet/PB/menu/1009328/index.php">
      <img border="0" src="images/spdde/portal/top/ch_quadrat_netzwerk_over.gif" width="49" height="49"></a></td>
      <td><img src="images/spdde/portal/top/t1_8_2.gif" border="0" width="49" height="49" /></td>
      <td><img src="images/spdde/portal/top/t1_10_2.jpg" alt="" width="49" height="49" /></td>
      <td><img src="images/spdde/portal/top/t1_12_2.jpg" alt="" width="49" height="49" /></td>
      <td><a target="_blank" href="http://www.spd.de/">
      <img src="images/spdde/portal/top/t1_14_2.gif" border="0" alt="" width="49" height="49" /></a></td>
    </tr>
    <tr>
      <td><img src="images/spdde/portal/top/t1_2_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_4_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_6_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_8_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_10_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_12_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_14_3.jpg" alt="" width="49" height="8" /></td>
    </tr>
  </table>

  <table border="0" cellspacing="0" cellpadding="0" width="750">
    <tr>
      <td><a href="kontakt.php">
      <img src="images/spdde/portal/top/t2.jpg" alt="" border="0" width="150" height="22" /></a></td>
      <td width="600" valign="middle" align="right">
      </td>
    </tr>
  </table>

  <table border="0" cellspacing="0" cellpadding="0" width="750">
    <tr>
      <td rowspan="2" width="150" valign="top">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><td><a target="_blank" href="http://www.spd.de/">
            <img src="images/spdde/portal/top/t3.jpg" alt="" border="0" width="150" height="58" /></a></td></tr>
          <tr><td><img src="images/spdde/common/trans.gif" width="1" height="16" alt="" border="0" /></td></tr>
        </table>
<!-- Beginn der Navigation-->        
<?php
include('./layout/navigation/left_navi.inc.php');
?>
<!-- Ende der Navigation-->

      </td>
      <td rowspan="2" valign="top"><img src="images/spdde/common/trans.gif" width="10" height="1" alt="" border="0" /></td>
      <td width="410" valign="top" bgcolor="#FDF8EF"> 
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FCDAD0">
          <tr>
            <td rowspan="3"><img src="images/spdde/common/trans.gif" width="8" height="1" alt="" /></td>
            <td><img src="images/spdde/common/trans.gif" width="1" height="2" alt="" /></td>
            <td rowspan="3"><img src="images/spdde/common/trans.gif" width="2" height="1" alt="" /></td>
          </tr>
          <tr><td width="400" height="14" valign="middle" class="pathnolink">
            <a href="index.php">SPD-Nast&auml;tten.de</a> &gt;
            <a href="kontakt.php">Kontakt</a></td></tr>
          <tr><td><img src="images/spdde/common/trans.gif" width="1" height="2" alt="" /></td></tr>
        </table>

<!-- Ueberschrift mit rotem Balken-->
        
        <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/spdde/common/trans.gif" width="16" height="12" alt="" /></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td></td>
            <td width="14" valign="bottom"><img src="images/spdde/portal/basics/quadrat_rechts.gif" width="10" height="6" alt="" /></td>
            <td width="364" valign="bottom"><b>Kontakt</b></td>
          </tr>
          <tr>
            <td></td>
            <td><img src="images/spdde/portal/basics/quadrat_rechts.gif" width="10" height="2" alt="" /></td>
            <td></td>
          </tr>
          <tr>
            <td></td>
            <td colspan="2" bgcolor="#A70D01"><img src="images/spdde/common/trans.gif" width="1" height="2" alt="" /></td>
          </tr>
        </table>

<!-- Ueberschrift mit rotem Balken Ende-->

<!-- Inhaltstabelle-->


        <table border="0" cellspacing="0" cellpadding="0" height="335">
          <tr>
            <td rowspan="2" height="335"><img src="images/spdde/common/trans.gif" width="16" height="2" alt="" /></td>
            <td width="378" height="316"><?php
if(isset($_POST['Submit'])){
  //Daten auslesen
  $message_recipient2 = $_POST['message_recipient'];
  $message_name       = $_POST['message_name'];
  $message_mail       = $_POST['message_mail'];
  $message_betreff    = $_POST['message_betreff'];
  $message_nachricht  = $_POST['message_nachricht'];
  $sicherheitscode    = $_POST['sicherheitscode'];

        //E-Mail Adresse entschl�sseln
        $select = "SELECT vorstand_email FROM spd_vorstand WHERE vorstand_email='".md5($message_recipient2)."'";
        $result = mysql_query($select);
        $dingens = mysql_fetch_array($result);
        $message_recipient = $dingens['vorstand_email'];

  //Sicherheitscode �berpr�fen
    function encrypt($string, $key) {
       $result = '';
       for($i=0; $i<strlen($string); $i++) {
          $char = substr($string, $i, 1);
          $keychar = substr($key, ($i % strlen($key))-1, 1);
          $char = chr(ord($char)+ord($keychar));
          $result.=$char;
       }
       return base64_encode($result);
       }

       $sicherheitseingabe = encrypt($sicherheitscode, "577gb43fe");
       $sicherheitseingabe = str_replace("=", "", $sicherheitseingabe);
       if($sicherheitseingabe == $_SESSION["rechen_captcha_spam"] AND $sicherheitscode == true){
       }else{
       $error_msg="Rechenaufgabe bitte richtig ausrechnen.<br>";
       }
       if(strlen($message_name)<5){
       $error_msg="Bitte geben Sie Ihren Namen an.<br>";
       }
       if(strlen($message_betreff)<5){
       $error_msg="Bitte geben Sie einen richtigen Betreff an. z.B. Error 404<br>";
       }
       if(!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$",$message_mail)){
       $error_msg.="Bitte geben Sie eine g&uuml;ltige E-Mail Adresse an.<br>";
       }
       if(strlen($message_nachricht)<10){
       $error_msg.="Bitte geben Sie an, welche Anfrage Sie an uns richten m&ouml;chten. (mindestens 10 Zeichen!)<br>";
       }
       if(isset($error_msg)){
       //Eines der Felder wurde nicht korrekt ausgef�llt
       echo "<h1>Anfrage abgelehnt!</h1>";
       echo "<b>Ihre Anfrage konnte aus folgenden Gr&uuml;nden leider nicht bearbeitet werden:<br></b>";
       echo $error_msg;
       echo "<br>Bitte klicken Sie auf <a href=javascript:history.back(1)>zur&uuml;ck</a> und f&uuml;llen Sie alle Felder aus.";
       }else{
       //Shit E-Mail generieren
       //Header
       $abgrenzung = md5(uniqid(rand()));
       $recipient = $message_recipient; //--> Pascal.Villmann@t-online.de
       $subject = $message_betreff;
       
       $header = "From: " . $message_name . "<" . $message_mail . ">" . "\n"; //--> von wem?
       $header.= "X-MAILER: PHP/" . phpversion() . "\n";
       $header.= "MIME-Version: 1.0" . "\n";
       $header.= "Content-Type: multipart/mixed; boundary = \"$abgrenzung\"\r\n";
       //Haupttext
       $mail_body = "--".$abgrenzung."\n";
       $mail_body.= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
       $mail_body.= "Content-Transfer-Encoding: 8bit\n\n";
       $mail_body.= "<h1>Kontakt</h1>";
       $mail_body.= "<h6>von <a href=\"http://spd-nastaetten.de\">SPD Nast&auml;tten</a></h6>";
       $mail_body.= "Das Kontakt Formular wurde am " . date("d.m.Y") . " um " . date("H:i") . "h ausgef&uuml;hrt.<br />";
       $mail_body.= "Folgende Werte wurden eingetragen:<br /><br />";
       $mail_body.= "<b>Name:</b> " . $message_name . "<br />";
       $mail_body.= "<b>E-Mail:</b> " . $message_mail . "<br />";
       $mail_body.= "<b>IP:</b> " . $ip . "<br />";
       $mail_body.= "<b>Host:</b> " . $host . "<br />";
       $mail_body.= "<b>Betreff:</b> " . $message_betreff . "<br /><br />";
       $mail_body.= "<b>Nachricht:</b><br />";
       $mail_body.= $message_nachricht . "<br /><br />";
       // abschlie�ende Begrenzung der Multipart-Mail
       $mail_body.= "<i>---- Ende der automatisch generierten E-Mail <br /> <b>Bei Missbrauch des Kontaktformulars
                     leiten Sie bitte diese E-Mail so schnell wie m&ouml;glich ohne Kommentar an die Webmaster weiter! (Pascal.Villmann@t-online.de oder lukas@d56355.de)</b> ----</i>";

       mail($recipient,$subject,$mail_body,$header);

       //Formular ausgef�hrt - Meldung ausgeben
       echo "Ihre Anfrage war erfolgreich! <br /> Vielen Dank daf&uuml;r!.<br />Wir werden sie so schnell wie m&ouml;glich beantworten!";
}
}else{
       ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
  <tr>
    <td>Empf&auml;nger:</td>
    <td><select name="message_recipient">
          <?php
                  $sql = "SELECT vorstand_order,vorstand_email,vorstand_name,vorstand_vorname FROM spd_vorstand ORDER BY vorstand_order DESC";
                  $result = mysql_query($sql);
                  if(isset($_GET['trme'])){ 
                  $undhiert = $_GET['trme']; 
                  }
                  while($jetzt = mysql_fetch_array($result)){
                          if($undhiert == md5($jetzt['vorstand_email'])){
                                  $undhier = 'selected';
                          }else{
                                  $undhier = '';
                          }
                          echo "<option value=\"".md5($jetzt['vorstand_email'])."\" ".$undhier.">".$jetzt['vorstand_vorname']." ".$jetzt['vorstand_name']."</option>"."\n";
                  }
                  ?>
        </select></td>
  </tr>
  <tr>
    <td>Vollst&auml;ndiger Name:</td>
    <td><input id="message_name" onClick="leeren('message_name'); return false;" name="message_name" size="40" maxlength="100" value="Bitte schreiben sie hier Ihren  Vor- und Nachnamen hin." /></td>
  </tr>
  <tr>
    <td>E-Mail Adresse:</td>
    <td><input id="message_mail" onClick="leeren('message_mail'); return false;" name="message_mail" size="40" maxlength="100" value="Bitte schreiben sie hier Ihre  E-Mail hin." /></td>
  </tr>
  <tr>
    </tr>
   <tr id="betreff" style="display:table-row;">
    <td>Betreff:</td>
    <td><input id="message_betreff" onClick="leeren('message_betreff'); return false;" name="message_betreff" size="40" maxlength="100" value="Bitte schreiben sie hier einen Betreff hin." /></td>
  </tr>
  <tr>
     <td>Nachricht</td>
     <td><textarea name="message_nachricht" rows="6" cols="40" wrap="virtual"></textarea></td>
  </tr>
  <tr>
     <td><img src="rechen-captcha.php" alt="" border="0" /></td>
     <td><input name="sicherheitscode" size="1" maxlength="4" /></td>
  </tr>
  <tr>
     <td colspan="2" align="center"><input name="Submit" type="submit" value="Abschicken" /></td>
  </tr>
</table>
</form>
<?php
}
?></td>
          </tr>
          <tr>
            <td width="378" height="19"> 
              &nbsp;</td>
          </tr>
        </table>
        
        
<!-- Inhaltstabelle Ende-->



      </td>
      <td rowspan="2"><img src="images/spdde/common/trans.gif" width="10" height="1" alt="" border="0" /></td>
      <td rowspan="2" width="170" valign="top" bgcolor="#FDF8EF">
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FCDAD0">
          <tr><td><img src="images/spdde/common/trans.gif" width="170" height="18" alt="" /></td></tr>
        </table>

        <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/spdde/common/trans.gif" width="12" height="25" alt="" /></td>
            <td></td>
          </tr>
          <tr>
            <td></td>
            <td><img src="images/spdde/portal/basics/linie_2nd.gif" width="146" height="1" vspace="2" alt="" /></td>
          </tr>
          <tr>
            <td></td>
            <td width="146"><span class="navi4thnolink">Interaktiv</span></td>
          </tr>
        </table>


<!-- Eintrag Interaktiv Anfang -->        
        <?php
include('./layout/navigation/right_navi.inc.php');
?>
<!-- Eintrag Interaktiv Ende -->
<?php
include('./layout/right.inc.php');
?>
      </td>
    </tr>
    <tr>  <!-- hier beginnt der footer -->
      <td width="410" valign="bottom" bgcolor="#FDF8EF">
        <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FDF8EF">
          <tr>
            <td rowspan="4"><img src="images/spdde/common/trans.gif" width="16" height="1" alt="" /></td>
            <td><img src="images/spdde/common/trans.gif" width="1" height="10" alt="" /></td>
          </tr>
          <tr>
            <td valign="top"><a href="#top">
            <img src="images/spdde/portal/basics/hoch.gif" border="0" alt="" width="8" height="8" /></a></td>
          </tr>
          <tr>
            <td bgcolor="#A70D01"><img src="images/spdde/common/trans.gif" width="378" height="2" alt="" /></td>
          </tr>
          <tr>
            <td height="16" valign="middle" align="right">&copy; <?php echo $global_copy . " - " . $global_years; ?> &nbsp;<a href="impressum.php">Impressum</a></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>

  </div>
</body>
</html>